package de.uhlesoluschns.opensearch;

import android.net.Uri;
import android.provider.LiveFolders;

public class OpenSearch {
	
//	public static final Uri ADD_PROVIDER_URI = Uri.parse("http://10.0.2.2:8081/m/");
	public static final Uri ADD_PROVIDER_URI = Uri.parse("http://android-open-search.appspot.com/m/");
	
	public static final String AUTHORITY = "de.uhlesoluschns.opensearch";
	
	private static final String CONTENT_SCHEME = "content:";
	
	private static final String CONTENT_TYPE = "vnd.android.cursor";
	private static final String CONTENT_TYPE_DIR = CONTENT_TYPE + ".dir";
	private static final String CONTENT_TYPE_ITEM = CONTENT_TYPE + ".item";
	
	private static final Uri BASE_URI = Uri.parse(String.format("%s//%s", CONTENT_SCHEME, AUTHORITY));
	private static final String BASE_CONTENT_DIR = String.format("%s/%s", CONTENT_TYPE_DIR, AUTHORITY);
	private static final String BASE_CONTENT_ITEM = String.format("%s/%s", CONTENT_TYPE_ITEM, AUTHORITY);
	
	public static class Provider {
		public static final String PATH = "engines";
		public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_URI, PATH);
		public static final String CONTENT_DIR = String.format("%s.%s", BASE_CONTENT_DIR, PATH);
		public static final String CONTENT_ITEM = String.format("%s.%s", BASE_CONTENT_ITEM, PATH);
		
		public static final String TABLE_NAME = "engines";
		public static final String COL_ID = "_id";
		public static final String COL_SHORT_NAME = "shortName";
		public static final String COL_DESCRIPTION = "description";
		public static final String COL_INPUT_ENCODING = "inputEncoding";
		public static final String COL_SEARCH_URL = "searchUrl";
		public static final String COL_SUGGESTION_URL = "suggestionUrl";
		public static final String COL_IMAGE = "image";
	}
	
	public static class ProviderLiveFolder {
		public static final String PATH = "live/engines";
		
		public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_URI, PATH);
		
		public static final String COL_ID = Provider.COL_ID + " AS " + LiveFolders._ID;
		public static final String COL_SHORT_NAME = Provider.COL_SHORT_NAME + " AS " + LiveFolders.NAME;
		public static final String COL_DESCRIPTION = Provider.COL_DESCRIPTION + " AS " + LiveFolders.DESCRIPTION;
		public static final String COL_IMAGE = Provider.COL_IMAGE + " AS " + LiveFolders.ICON_BITMAP;
	}
	
	public static class Suggestion {
		public static final String PATH = "suggestions";
		public static final Uri CONTENT_URI = Uri.withAppendedPath(BASE_URI, PATH);
		public static final String CONTENT_DIR = String.format("%s.%s", BASE_CONTENT_DIR, PATH);
		public static final String CONTENT_ITEM = String.format("%s.%s", BASE_CONTENT_ITEM, PATH);
		
		public static final String COL_ID = "_id";
		public static final String COL_SUGGESTION = "suggestion";
	}
}
